package org.raymond.iworks.study.redis.redisson;

import lombok.extern.slf4j.Slf4j;
import org.redisson.Redisson;
import org.redisson.api.RBucket;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;

import java.time.Duration;

/**
 * @author raymond
 * @version V1.0
 * @Description: TODO
 */
@Slf4j
public class QuickStart {
    public static void main(String[] args) throws InterruptedException {
        test1();
    }

    public static void test1() throws InterruptedException {
        Config cfg = new Config();
        cfg.useSingleServer().setAddress("redis://192.168.0.125:6379");
        RedissonClient client = Redisson.create(cfg);

        RBucket<String> bucket = client.getBucket("world");
        bucket.set("hello", Duration.ofMinutes(1));
        Thread.sleep(10);
        log.info("bucket:{}", bucket.get());
        client.shutdown();
    }
}
